package com.codeyang.mocktest2.mockit;

import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;

import java.util.List;

/**
 * 16 @Mock 注解
 */
public class MockitoTest01 {
    @Mock
    private List mockList;

    //必须在基类中添加初始化mock的代码，否则报错mock的对象为NULL
    public MockitoTest01() {
        MockitoAnnotations.initMocks(this);
    }

    @Test
    public void AnnoTest() {
        mockList.add(1);
        Mockito.verify(mockList).add(1);
    }
}